﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<dbPoll_Application.ViewModels.PollReportViewModel>" %>
<%@ Import Namespace="dbPoll_Application.Models" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Reports
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <script src="../../Scripts/_lib/jquery.js" type="text/javascript"></script>
    <script src="../../Scripts/jquery.jstree.js" type="text/javascript"></script>
    <script src="../../Scripts/Poll-QuestionReportGraphical.js" type="text/javascript"></script>

    <div class="pageHeadingContainer"><h2 class="pageHeading">Poll Reports</h2></div>
    <div id="contentContainer">
        <p><%= Html.ActionLink("Polls > ", "Index", "Poll", null, new { @class = "breadcrumb" })%><%= Model.name %></p>
        <div id="pageMenuContainer">
            <span id="launchScreen"><%= Html.ActionLink("Go back to reports", "Reports", new { pollID = Model.pollID })%></span>
            <ul id="pageMenu">
                <li><%= Html.ActionLink("Details", "Questions", new { pollID = Model.pollID }) %></li>
                <li><%= Html.ActionLink("Run", "SetSession", new { pollID = Model.pollID }) %></li>
                <li><%= Html.ActionLink("Test", "Test", new { pollID = Model.pollID }) %></li>
                <li>Reports</li>
                <li><%= Html.ActionLink("Manage Hierarchy", "EntityHierarchy", new { pollID = Model.pollID })%></li>
            </ul>
        </div>
        
        <div id="hierarchyContainer2">
            <div id="respondQuestionContainerPadding">
            <div id="respondInstructions2"><p><p>Select the entities by which to aggregate the results.</p>
            </div>
            <div id="respondOptionsContainer">
                <%= Html.HiddenFor(model => model.pollID) %>
                <div id="tree">
                    <ul>
                    <% var tree = dbPoll_Application.Controllers.PollController.GetEntityTree(Model.root);
                    if (!String.IsNullOrEmpty(tree))
                    { %>    
                        <%= tree %>
                    <%} 
                    else
                    { %>
                        <li id="-1"><a href="#">New</a></li>
                    <%} %>
                    </ul>
                </div>
            </div>
        </div>
        <input type="button" id="applyFilters" value="Apply" />
        </div>
        
            <% using (Html.BeginForm("QuestionReportTextualPlain","Poll",FormMethod.Post)) { %>
            <input type="hidden" id="urls" name="urls" />
            <input type="hidden" id="name" name="name" value="Results by Question Report" />
    <input type="hidden" name="PollID" value="<%=Model.pollID %>" />
    <input type="hidden" id="selectedEntities" name="selectedEntities" value="" />
    <input type="submit" value="Generate PDF" id="generatePDF"/><%}%>
    <div id="reportGraphical">
    <% Html.RenderPartial("ReportGraphical", Model); %>
    </div>
    </div>

        
</asp:Content>
